
/**
 * Permet de parser de String en Number
 * @author kevin
 * @Class Parser.java
 * @version 1.0
 */
public class Parser {
	/**
	 * String to Integer
	 * @param x
	 * @return Integer
	 */
	public static Integer StringToInteger(String x){
		Integer num = null;
		try{
			num = Integer.parseInt(x);
			return num;
		}catch(NumberFormatException e)
		{
			return null;
		}
	}
	/**
	 * String To Double
	 * @param x
	 * @return Double
	 */
	public static Double StringToDouble(String x)
	{
		Double num = null;
		try{
			num = Double.parseDouble(x);
			return num;
		}catch(NumberFormatException e)
		{
			return null;
		}
	}
	/**
	 * String To Long
	 * @param x
	 * @return Long
	 */
	public static Long StringToLong(String x)
	{
		Long num = null;
		try{
			num = Long.parseLong(x);
			return num;
		}catch(NumberFormatException e)
		{
			return null;
		}
	}
	
	/**
	 * String To Short
	 * @param x
	 * @return Short
	 */
	public static Short StringToShort(String x)
	{
		Short num = null;
		try{
			num = Short.parseShort(x);
			return num;
		}catch(NumberFormatException e)
		{
			return null;
		}
	}
	
	/**
	 * Number To String
	 * @param x
	 * @return String
	 */
	public static String NumberToString(Number x){
		return x.toString();
	}
	
	
}
